<?php $this->load->view('admin/public/head.html', array('css' => array(
    '/assets/admin/css/admin/common.css'
))); ?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper systemAdmin" ng-controller="admin-admin-role-add">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            管理员设置
            <small>设置用户角色</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i>后台首页</a></li>
            <li class="active">管理员设置</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content">

        <div class="row">

            <div class="col-md-12">
                <div class="box">
                    <div class="box-header with-border">
                        <h3 class="box-title">添加角色</h3>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">

                        <form class="form-horizontal">
                            <div class="form-group">
                                <label for="name" class="col-sm-2 control-label">角色名称</label>
                                <div class="col-sm-3">
                                    <input type="text" class="form-control" ng-model="roleName" id="name" placeholder="请输入角色名称">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">分配权限</label>
                                <div class="col-sm-10">

                                    <table class="table purchaser-table">
                                        <tbody ng-repeat="($index, role) in roles">
                                            <tr>
                                                <td colspan="2">
                                                    <div class="checkbox">
                                                        <label ng-click="selectRole(role.id, role.level)">
                                                            <i class="fa fa-square-o" id="role-{{role.id}}"></i>
                                                            &nbsp;&nbsp;<span ng-bind="role.name"></span></label>
                                                    </div>
                                                </td>
                                                <td ng-bind="role.icon"></td>
                                                <td ng-bind="role.url"></td>
                                            </tr>
                                            <tr ng-repeat="($index, item) in role.subMenu">
                                                <td>&nbsp;</td>
                                                <td>
                                                    <div class="checkbox">
                                                        <label ng-click="selectRole(item.id, item.level)">
                                                            <i class="fa fa-square-o" id="item-{{item.id}}"></i>
                                                            &nbsp;&nbsp;
                                                            <span ng-bind="item.title"></span></label>
                                                    </div>
                                                </td>
                                                <td ng-bind="item.controller"></td>
                                                <td>&nbsp;</td>
                                            </tr>
                                        </tbody>
                                    </table>

                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label"></label>
                                <div class="col-sm-3">
                                    <button class="btn btn-info" ng-click="save()" style="background: #00a65a; border: none;" ng-if="pagetype=='add'">创建角色</button>&nbsp;&nbsp;
                                    <button class="btn btn-info" ng-click="save()" ng-if="pagetype=='edit'">修改权限</button>&nbsp;&nbsp;
                                    <a href="/admin/role/index" class="btn btn-default">返回列表</a>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>

    </section>
    <!-- /.content -->
</div>

<!-- /.content-wrapper -->
<?php $this->load->view('admin/public/foot.html', array('js' => array(
    '/assets/admin/js/admin/role_add.js'
))); ?>
